/**
 * 2016，thor.com，all rights reserved。
 * 
 * Project：		palmmall-core
 * Filename：	AStoreQueryParamConverter.java
 * Created：		2016年9月5日
 * Creator：		wolv
 */
package com.thor.palmmall.rest.common;

import java.util.ArrayList;

import org.springframework.core.convert.converter.Converter;

import com.thor.commons.entity.KV;
import com.thor.palmmall.spi.common.SUserGroupLoadParam;

/**
 * @author wolv
 *
 */
public class SUserGroupLoadParamConverter implements Converter<AUserGroupLoadParam, SUserGroupLoadParam> {

	public static SUserGroupLoadParamConverter getInstance() {
		if (instance == null)
			instance = new SUserGroupLoadParamConverter();
		return instance;
	}

	private static SUserGroupLoadParamConverter instance;

	private SUserGroupLoadParamConverter() {
	}

	@Override
	public SUserGroupLoadParam convert(AUserGroupLoadParam source) {
		if (source == null)
			return null;

		SUserGroupLoadParam target = new SUserGroupLoadParam();
		target.setStores(new ArrayList<String>());
		if (source.getStores() != null)
			target.getStores().addAll(source.getStores());
		target.setUserGroups(new ArrayList<KV>());
		if (source.getUserGroups() != null)
			target.getUserGroups().addAll(source.getUserGroups());

		return target;
	}
}
